import { createStore } from 'vuex'

export default createStore({
  state: {
    uiDrawerSize: '670px', // 抽屉尺寸
    uiDrawerSizeBig: '900px', // 抽屉尺寸
    uiBlue: '#477AFD', // 蓝色
    uiPageSizes: [20, 30, 50, 100], // 分页切换每页数据
    uiPageSizeDefault: 30, // 分页默认每页条数
    uiTextareaLength: 140, // 文本域 最大字数
    dictObj: JSON.parse(localStorage.getItem('dataDictionary')) || []
  },
  getters: {
    getDictObj: (state) => (keys) => {
      if (Object.prototype.toString.call(keys) == '[object Array]' && keys.length > 0){
        let obj = {}
        keys.map(item => {
          obj[item] = state.dictObj[item] || []
        })
        return obj
      }
    }
  },
  mutations: {
  },
  actions: {
  },
  modules: {
  }
})
